/* $Id: FileMenu.java 60 2010-02-01 19:54:35Z aaron.day $ */
package org.crazydays.gameplan.view;


import javax.swing.JMenu;
import javax.swing.JMenuItem;

import org.crazydays.gameplan.action.ExitApplication;
import org.crazydays.gameplan.db.action.CloseDatabase;
import org.crazydays.gameplan.db.action.CreateDatabase;
import org.crazydays.gameplan.db.action.OpenDatabase;
import org.crazydays.gameplan.db.action.SaveDatabase;
import org.crazydays.gameplan.db.action.SaveDatabaseAs;
import org.crazydays.gameplan.map.action.CreateMapDialog;
import org.crazydays.i18n.Messages;

/**
 * FileMenu
 */
public class FileMenu
    extends JMenu
{
    /** serial version uid */
    public final static long serialVersionUID =
        "$Id: FileMenu.java 60 2010-02-01 19:54:35Z aaron.day $".hashCode();

    /** messages */
    protected final static Messages MESSAGES = Messages.getInstance();

    /** create database */
    protected CreateDatabase createDatabase;

    /** open database */
    protected OpenDatabase openDatabase;

    /** close database */
    protected CloseDatabase closeDatabase;

    /** save database */
    protected SaveDatabase saveDatabase;

    /** save database as */
    protected SaveDatabaseAs saveDatabaseAs;

    /** create map dialog */
    protected CreateMapDialog createMapDialog;

    /** exit application */
    protected ExitApplication exitApplication;

    /**
     * FileMenu constructor.
     */
    public FileMenu()
    {
        super(MESSAGES.format("GamePlan.menu.file"));
    }

    /**
     * Build file menu.
     */
    protected void initialize()
    {
        add(new JMenuItem(createDatabase));
        add(new JMenuItem(openDatabase));
        add(new JMenuItem(closeDatabase));
        addSeparator();
        add(new JMenuItem(saveDatabase));
        add(new JMenuItem(saveDatabaseAs));
        addSeparator();
        add(new JMenuItem(createMapDialog));
        addSeparator();
        add(new JMenuItem(exitApplication));
    }

    /**
     * Set create database.
     * 
     * @param createDatabase CreateDatabase
     */
    public void setCreateDatabase(CreateDatabase createDatabase)
    {
        this.createDatabase = createDatabase;
    }

    /**
     * Set open database.
     * 
     * @param openDatabase OpenDatabase
     */
    public void setOpenDatabase(OpenDatabase openDatabase)
    {
        this.openDatabase = openDatabase;
    }

    /**
     * Set close database.
     * 
     * @param closeDatabase CloseDatabase
     */
    public void setCloseDatabase(CloseDatabase closeDatabase)
    {
        this.closeDatabase = closeDatabase;
    }

    /**
     * Set save database.
     * 
     * @param saveDatabase SaveDatabase
     */
    public void setSaveDatabase(SaveDatabase saveDatabase)
    {
        this.saveDatabase = saveDatabase;
    }

    /**
     * Set save database as.
     * 
     * @param saveDatabaseAs SaveDatabaseAs
     */
    public void setSaveDatabaseAs(SaveDatabaseAs saveDatabaseAs)
    {
        this.saveDatabaseAs = saveDatabaseAs;
    }

    /**
     * Set create map dialog.
     * 
     * @param createMapDialog CreateMapDialog
     */
    public void setCreateMapDialog(CreateMapDialog createMapDialog)
    {
        this.createMapDialog = createMapDialog;
    }

    /**
     * Set exit application.
     * 
     * @param exitApplication ExitApplication
     */
    public void setExitApplication(ExitApplication exitApplication)
    {
        this.exitApplication = exitApplication;
    }
}
